package com.bsdk.install.device.socket.v1.cmd;

/**
 * @ProjectName: com.hlslock.utils.lock
 * @Package: com.hlslock.utils.lock
 * @ClassName: ICmd
 * @Author: HansYoung
 * @Description: cmd
 * @Createtime: 2023/12/11 08:40
 * @Modifytime: 2023/12/14 20:44
 * @Version: 1.0
 * @Copyright: ©2006-2023 版权所有. 深圳豪力士
 */
public interface ICmd {
    public static final String VERSION = "V1.0.0";
    /**
     * 返回指令常量
     */
    public static final int STATUS_SUCCESS = 200; //请求正确，如开锁，下发各类指令

    public static final int STATUS_ERROR = 500; //指令错误
    //


    public static final byte  SOCKET_TYPE_LINE_GND = 0x00; //零火开关
    public static final byte  SOCKET_TYPE_SINGLE_LINE = 0x01; //零火开关

    public static final byte  SOCKET_ACTION_OFF_CMD = 0x00; //关灯
    public static final byte  SOCKET_ACTION_ON_CMD = 0x01; //开灯
    public static final byte  SOCKET_ACTION_TRIGLE_CMD = 0x02; //模拟按键

    public static final byte  SOCKET_GET_LOCAL_KEY_STATUS = 0x13; //获取开关的状态
    public static final byte  SOCKET_SET_ALL_KEY_CMD = 0x14; //ON/OFF,传送物理key
    public static final byte  SOCKET_SET_SINGLE_KEY_CMD = 0x15; //on/off/triggle，传送逻辑key
    public static final byte  SOCKET_REP_KEY_STATUS_CMD = (byte)0x83; //灯的状态上报

    //以下是网关的注册
    public static final byte  CHILD_SET_MASTER_ADDR_CMD = (byte) 0x7E; //注册模块
    public static final byte  CHILD_REQ_MASTER_ADDR_CMD = (byte) 0x7F; //查询模块注册


    //模块的通讯协议
    public final int MOUDLE_CMD_RECEIVE_HEAD = 0x00;
    public final int MOUDLE_CMD_RECEIVE_LEN1 = 0x01;
    public final int MOUDLE_CMD_RECEIVE_LEN2 = 0x02;
    public final int MOUDLE_CMD_RECEIVE_CMD_DATA = 0x04;
    public final int MOUDLE_CMD_RECEIVE_CRC = 0x05;
    public final int MOUDLE_CMD_RECEIVE_TAIL = 0x06;
    public final int MOUDLE_CMD_RECEIVE_OK = 0x07;


    /**
     * 网关协议
     * @param byteData
     * @param len
     * @return
     */
    byte check_crc(byte[] ptr, int n);
    public  String pack_crc(byte[] data, int len);
    byte[] toBytes(String s);
}